﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Dazaza.UI.Mvc.Models
{
    /// <summary>
    /// 分页信息
    /// </summary>
    public class PagerInfo
    {
        private string linkFormat;
        private string[] prePageLinkParameters;
        private string[] nextPageLinkParameters;

        public int PageIndex { get; set; }
        public int PageSize { get { return 15; } }
        public int PageCount
        {
            get
            {
                if (PageSize == 0)
                {
                    return 1;
                }
                return RecordCount / PageSize + 1;
            }
        }
        public int RecordCount { get; set; }

        
        /// <summary>
        /// 链接格式 {0} 表示页面的pageindex
        /// 比如 /hot_{1}_p{0} {1}表示LinkParameters传递的分类 {0}表示pageindex
        /// </summary>
        public string LinkFormat 
        { 
            get 
            { 
                if (linkFormat == null) 
                {
                    return string.Empty;
                }
                return linkFormat;
            } 
            set
            {
                linkFormat = value;
            }
        }

        /// <summary>
        /// 链接格式参数 
        /// </summary>
        public string[] PrePageLinkParameters
        {
            get
            {
                if (prePageLinkParameters == null)
                {
                    prePageLinkParameters = new string[] { };
                }
                return prePageLinkParameters;
            }
            set
            {
                prePageLinkParameters = value;
            }
        }
        public string[] NextPageLinkParameters
        {
            get
            {
                if (nextPageLinkParameters == null)
                {
                    nextPageLinkParameters = new string[] { };
                }
                return nextPageLinkParameters;
            }
            set
            {
                nextPageLinkParameters = value;
            }
        }



        
    }
}